home *** CD-ROM | disk | FTP | other *** search
/ Ultra Pack / UltraComputing Partner Applications.iso / SunLabs / tclTK / src / tk4.0 / tkAppInit.c < prev    next >
C/C++ Source or Header  |  1995-06-28  |  3KB  |  112 lines

  1. /* 
  2.  * tkAppInit.c --
  3.  *
  4.  *    Provides a default version of the Tcl_AppInit procedure for
  5.  *    use in wish and similar Tk-based applications.
  6.  *
  7.  * Copyright (c) 1993 The Regents of the University of California.
  8.  * Copyright (c) 1994 Sun Microsystems, Inc.
  9.  *
  10.  * See the file "license.terms" for information on usage and redistribution
  11.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12.  */
  13.  
  14. #ifndef lint
  15. static char sccsid[] = "@(#) tkAppInit.c 1.15 95/06/28 13:14:28";
  16. #endif /* not lint */
  17.  
  18. #include "tk.h"
  19.  
  20. /*
  21.  * The following variable is a special hack that is needed in order for
  22.  * Sun shared libraries to be used for Tcl.
  23.  */
  24.  
  25. extern int matherr();
  26. int *tclDummyMathPtr = (int *) matherr;
  27.  
  28. /*
  29.  *----------------------------------------------------------------------
  30.  *
  31.  * main --
  32.  *
  33.  *    This is the main program for the application.
  34.  *
  35.  * Results:
  36.  *    None: Tk_Main never returns here, so this procedure never
  37.  *    returns either.
  38.  *
  39.  * Side effects:
  40.  *    Whatever the application does.
  41.  *
  42.  *----------------------------------------------------------------------
  43.  */
  44.  
  45. int
  46. main(argc, argv)
  47.     int argc;            /* Number of command-line arguments. */
  48.     char **argv;        /* Values of command-line arguments. */
  49. {
  50.     Tk_Main(argc, argv, Tcl_AppInit);
  51.     return 0;            /* Needed only to prevent compiler warning. */
  52. }
  53.  
  54. /*
  55.  *----------------------------------------------------------------------
  56.  *
  57.  * Tcl_AppInit --
  58.  *
  59.  *    This procedure performs application-specific initialization.
  60.  *    Most applications, especially those that incorporate additional
  61.  *    packages, will have their own version of this procedure.
  62.  *
  63.  * Results:
  64.  *    Returns a standard Tcl completion code, and leaves an error
  65.  *    message in interp->result if an error occurs.
  66.  *
  67.  * Side effects:
  68.  *    Depends on the startup script.
  69.  *
  70.  *----------------------------------------------------------------------
  71.  */
  72.  
  73. int
  74. Tcl_AppInit(interp)
  75.     Tcl_Interp *interp;        /* Interpreter for application. */
  76. {
  77.     Tk_Window main;
  78.  
  79.     if (Tcl_Init(interp) == TCL_ERROR) {
  80.     return TCL_ERROR;
  81.     }
  82.     if (Tk_Init(interp) == TCL_ERROR) {
  83.     return TCL_ERROR;
  84.     }
  85.  
  86.     /*
  87.      * Call the init procedures for included packages.  Each call should
  88.      * look like this:
  89.      *
  90.      * if (Mod_Init(interp) == TCL_ERROR) {
  91.      *     return TCL_ERROR;
  92.      * }
  93.      *
  94.      * where "Mod" is the name of the module.
  95.      */
  96.  
  97.     /*
  98.      * Call Tcl_CreateCommand for application-specific commands, if
  99.      * they weren't already created by the init procedures called above.
  100.      */
  101.  
  102.     /*
  103.      * Specify a user-specific startup file to invoke if the application
  104.      * is run interactively.  Typically the startup file is "~/.apprc"
  105.      * where "app" is the name of the application.  If this line is deleted
  106.      * then no user-specific startup file will be run under any conditions.
  107.      */
  108.  
  109.     tcl_RcFileName = "~/.wishrc";
  110.     return TCL_OK;
  111. }
  112.